home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / grouprotate.pprx < prev    next >
Text File  |  1992-03-14  |  2KB  |  82 lines

  1. /*
  2. @BGroupRotate  @P@ICopyRight Gold Disk Inc., February, 1992
  3.  
  4. This Genie will rotate a group given an angle. This will only work for boxes that are on a page. Note that this Genie will rotate boxes @Iby@P the given angle not @Ito@P the given angle. The angle specified is added to the angle of each box in the group.
  5. */
  6. numeric digits 8
  7. rad = 3.1415926 / 180
  8. address command
  9. call SafeEndEdit.rexx()
  10. call ppm_AutoUpdate(0)
  11. units = ppm_GetUnits()
  12. if units = 3 then
  13.     call ppm_SetUnits(1)
  14.  
  15. signal on halt
  16. signal on break_c
  17. signal on break_e
  18. signal on break_d
  19.  
  20. if ~show('l', "gdarexxsupport.library") then
  21.     if ~addlib("gdarexxsupport.library",0,-30) then
  22.             call exit_msg("Please install the gdarexxsupport.library in your libs: directory before running this Genie")
  23.  
  24. box     = ppm_GroupFirstBox()
  25. if box  = 0 then exit_msg("Select a group first")
  26.  
  27. angle   = strip(ppm_GetForm("Rotation Angle", 8, "Angle"))
  28. if angle = '' then exit_msg()
  29.  
  30. if  datatype(angle) ~= NUM then
  31.     exit_msg("Invalid Input")
  32.  
  33. rangle  = angle * rad
  34. cosa    = cos(rangle)
  35. sina    = sin(rangle)
  36.  
  37. call ppm_ShowStatus("Working..")
  38.  
  39. grouprect   = ppm_GetGroupRect()
  40. grpleft     = word(grouprect, 1)
  41. grptop      = word(grouprect, 2)
  42.  
  43. do while box ~= 0
  44.  
  45.     boxpos  = ppm_GetBoxPosition(box)
  46.     boxleft = word(boxpos, 1)
  47.     boxtop  = word(boxpos, 2)
  48.  
  49.     call ppm_SetBoxAngle(box, angle + ppm_GetBoxAngle(box))
  50.  
  51.     xoffset = boxleft - grpleft
  52.     yoffset = boxtop - grptop
  53.  
  54.     x   = grpleft + xoffset * cosa + yoffset * sina
  55.     y   = grptop +  yoffset * cosa - xoffset * sina
  56.  
  57.     call ppm_SetBoxPosition(box, x, y)
  58.  
  59.     box = ppm_GroupNextBox(box)
  60. end
  61.  
  62. exit_msg()
  63. break_d:
  64. break_e:
  65. break_c:
  66. halt:
  67.     call exit_msg("User aborted Genie!")
  68.  
  69. exit_msg: procedure expose units
  70. do
  71.     parse arg message
  72.  
  73.     if message ~= '' then
  74.         call ppm_Inform(1, message, )
  75.  
  76.     call ppm_ClearStatus()
  77.     if units = 3 then call ppm_SetUnits(3)
  78.     call ppm_AutoUpdate(1)
  79.     exit
  80.  
  81. end
  82.